‫Welcome to lecture 11 here, I am going to show you how you can manipulate other documents from within
‫your API and what you are going to be doing here.
‫I have opened to the notes.
‫Right now it is empty.
‫And I also have my items table with two items, as you can see.
‫Not what you want to be doing is that we are going to be adding an item here and everything.
‫We add an item.
‫The system is going to trigger a note that is going to be associated in the note stable, telling whoever
‫is concerned that a new node has been a new item has been added to the document.
‫So what you can do after another has been added there.
‫You can send a message.
‫You can maybe basically you can do whatever you want to do with that.
‫So what you want to do here, you want to define a new function that's going to be good at what?
‫And then this function is going to have the function or the code that's going to be adding our our there's
‫going to be adding our nodes.
‫So what I want to do here is I want to do a very good at node, which I'm going to assign to frontier
‫dot db dot, dot, dot, dot, dot, dot, dot, get, because I want to get the document to get document
‫and then after I get the document course I'm going to tell it with the document I want to get.
‫Remember this, when you are doing our Esat you're going to supply the duct tape and the duct tape that
‫you want to get here is there and then duct tape.
‫Not sorry but they're not duct tape.
‫Remember we're starting a new node and then here you to apply the two things that we need to pass.
‫If you come to the duct tape and you try to add a note, we have a title and we have a public, I'm
‫going to assume that and we have the content.
‫So I'm going to be putting in the data and the content only.
‫So when I come back here, I have title that of this one.
‫I'm going to have to call it for now, but I'm going to show you how to do how to make it dynamic so
‫that it has the contents of whatever, whatever, whatever item that has been added.
‫And then we have here content.
‫And again, I'm going to go to this let me see the content for I to go to something like that.
‫And then here we're going to see Datafolha.
‫No, something like that.
‫OK.
‫So why is this one complaining, because we do not have accommodation.
‫All right.
‫And then remember what we are doing the year after this is to delete the addnode dot.
‫What do we want to do here is addnode dot insert, I hope you guessed it.
‫And then after that you're going to do Frappier dot the dot com it.
‫OK, now this one's you do not need to wait listed.
‫You do not need to to give it to give it to call it from from from our postman.
‫Remember you went to this one is not going to be called.
‫Actually the users are not going even to know that this has happened.
‫It is going to happen within within the European application itself.
‫So what you want to do, this function that we have here, we are going to call it inside of the add
‫item just after before we do the return, we are going to call that function.
‫So let me call it and add new node.
‫And remember, this one is not known to me to call this add new node.
‫So that is different from this.
‫OK, addNode, the function itself is not great.
‫So we can go ahead now and try to add a new item.
‫And all they expect is that after I have added a new item, it is going to add the item and then call
‫this function and then return with this function is going to be called.
‫It is going to come down here and create a new node in it into our database.
‫Lets see what happens here in the U.S. we have nothing and in the items we have to add them.
‫So at the end, we want after we have got it, one three items here in the note here and see whether
‫that happens.
‫So go back to our API to add an item.
‫We can add an item called X, X, X, no problem.
‫Send it and we get a success here.
‫So that means we should have an item here, which we have data for our note.
‫And here is would have another item added.
‫Perfect, not once.
‫Great.
‫So what we have done ideally is we have written a function with the title and the content and then we
‫have called this function inside of our auditing function.
‫Now what if we need this thing to be dynamic such that it details whoever is concerned?
‫Maybe is the director of this company.
‫They are imaginary company or whatever.
‫There's this directive.
‫A new item with this name has been added to the to the design.
‫Because what we do we do here is that you're going to hear the name and maybe the groups, what we tell
‫them also, which will be the has been added.
‫And then here we are going to do I can just compose to to what it was here, what is called title.
‫And this is going to be a formatted string and sing sing something like in to to name B has been added
‫to items OK.
‫And, of course.
‫I am still only
‫there is only this one is complaining is because we did not receive the items we need again here to
‫receive the item and the group.
‫So this one I stopped complaining to have something like name has been added to items.
‫And then we have the content and the content is going to be a formatted string.
‫Seeing something like what we put, you can put anything.
‫I can see our new item with with the with the name, with the name name
‫has being added to the group, to the baby group, to their products, to products and maybe something
‫like two products.
‫OK, that's it.
‫So this these two what we are going to be buzzing here.
‫So now I can remove this and massively piece that and then the title is going to come to the title place.
‫So we have the title and then we have that.
‫So now and we call this function, we expect this thing to be a little bit more beautiful because it
‫is going to give us these messages, these messages that we can we can relate with.
‫So let me go here and go this y y y y and then I'm going to say this is something like whichever call
‫this second and then I remove that and send it.
‫And we have a success message here.
‫So it looks like we have some success.
‫It must be successfully inserted.
‫So they come here, reload.
‫We see second item code, second item, second item, second has been added.
‫OK, is that how you have called it.
‫You have called it second Ippei.
‫Their second.
‫Yeah.
‫Something like the second item.
‫The second.
‫So let me go to this test item so that we know what we call it.
‫Bread, bread, some like bread, OK, in products.
‫So it's because completely because of this.
‫So we need to change this, maybe to Z then we go and send it in.
‫Yes, it's successful.
‫And now here in the notes we have bread has been added to items beautiful.
‫And when you open it, it is is our new item with the name bread has been added to products.
‫You see that has come from our API.
‫So now this is being called everything that we add a new item, we add a new item it because this function,
‫it passes the two parameters, that is the name on the group.
‫And then when it comes here at the Prince, this is the add another note.
‫And now here you can be able to do any other thing like slenderness, send under notification and everything
‫else that you need to do here.
‫It's up to you.
‫Thank you so much for giving me an opportunity to try new ERP next API.
‫I am hopeful that this series has made you into a developer that you want to be.
‫I am also hopeful that you can now write your own APIs, you can customize applications and you are
‫able to meet the needs of your clients.
‫If there is anything that you need me to help you with, please feel free to reach out to me.
‫Also, note that I am going to be producing other content on ERP next development.
‫And if you want to receive this content, please head over to my website.
‫Could really kind of come and leave your email everytime there is new content.
‫I'm going to be emailing you the details of the same.
‫Thank you.
‫And see you next time.